package cn.sofwin.day0120.bank.com;

import java.util.Scanner;

/**
 *
 * @author lsp
 * @email 1540174302@qq.com
 */
public class Account {
    int money;  //  存入的钱
    int x ;  //  x为余额

    public void yi(){
        Scanner sc = new Scanner(System.in);
        System.out.print("1:存款");
        System.out.print("\t2.取款");
        System.out.println("\t0.退出");
        System.out.print("请选择你需要办理的业务:");


        int select;
        select = sc.nextInt();
        switch (select){
            case 1:
                Deposit();
                break;
            case 2:
                withdraw();
                break;
            case 0:
                System.out.println("谢谢使用");
                break;
        }
    }

    public void Deposit(){  //存款       withdraw
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入存款金额:");

         money = sc.nextInt();

        System.out.println("********存款成功********");
        x += money;
        System.out.println("余额为："+x);
        System.out.println("\n") ;
    }


    public void withdraw(){
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入取款金额:");

        money = sc.nextInt();

        System.out.println("********取款成功********");
        x -= money;
        System.out.println("余额为："+x);
        System.out.println("\n") ;


    }








}
